<include file="__THEME__/public_header" />

<div id="page-wrap">
	<div class="reg-wrap">
	   <div class="reg-main">
		<div class="article boxShadow">
			<div class="title">{:L('PUBLIC_RESET_PASSWORD')}</div>
			<dl class="search-find">
				<dt>
				<form id="find_password_form" method="POST" action="{:U('public/Passport/doFindPasswordByEmail')}">
					<input id="pwd_input" name="email" type="text" class="s-txt"  onblur="this.className='s-txt';" onfocus="this.value='';this.className='s-txt-focus'" />
					<a href="javascript:;" onclick="$('#find_password_form').submit();" class="btn-green-big"><span>{:L('PUBLIC_SEND')}</span></a>
				</form>
				</dt>
	            <dd>{:L('PUBLIC_PASSWORD_EMAIL_INPUT')}</dd>
	            <dd>{:L('PUBLIC_PASSWORD_EMAIL_TIPS')}</dd>
			</dl>
		</div>
	  </div>
	</div>
</div>

<script type="text/javascript" src="__THEME__/js/jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $('#find_password_form').submit(function(){
        $(this).ajaxSubmit({
            beforeSubmit: checkPwdForm,
            dataType: "json",
            success: pwdCallback
        }); 
        return false; 
    });
    // 检查数据正确性
    var checkPwdForm = function() {
		var pwdText = $("#pwd_input").val();
		pwdText = $.trim(pwdText);
		if(pwdText == "") {
			ui.error("请输入你的邮箱地址");
			return false;
		}
		// '/[_a-zA-Z\d\-\.]+(@[_a-zA-Z\d\-\.]+\.[_a-zA-Z\d\-]+)+$/i'
		// var eMailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/;
		var eMailReg = /[_a-zA-Z\d\-\.]+(@[_a-zA-Z\d\-\.]+\.[_a-zA-Z\d\-]+)+$/i;
		if(!eMailReg.test(pwdText)) {
			ui.error("邮箱格式不正确");
			return false;
		}
    };
    // 回调函数
    var pwdCallback = function(msg) {
    	if(msg.status == 1) {
    		ui.success(msg.info);
    		return false;
    	} else {
    		ui.error(msg.info);
    		return false;
    	}
    };
});
</script>
<include file="__THEME__/public_footer" />